package me.jessyan.mvparms.demo.mvp.ui.adapter;

import android.view.View;
import android.widget.TextView;

import com.jess.arms.base.BaseHolder;
import com.jess.arms.base.DefaultAdapter;

import com.platform.ai.control.R;
import com.zhy.autolayout.AutoRelativeLayout;

import java.util.List;

import butterknife.BindView;


/**
 * Created by 95 on 2017/9/5.
 */
public class MainUIAdapter extends DefaultAdapter<String> {

    public MainUIAdapter(List<String> titles) {
        super(titles);
    }

    @Override
    public BaseHolder getHolder(View v, int viewType) {
        return new TitleUiHolder(v);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_main_title_ui;
    }

    public class TitleUiHolder extends BaseHolder<String> {
        @BindView(R.id.item_card_bg)
        AutoRelativeLayout mBg;

        @BindView(R.id.tv_item_title)
        TextView mTv;

        public TitleUiHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData(String title, int position) {
            mTv.setText(title);
            if(position == 0){
                mBg.setBackgroundResource(R.drawable.bg_card_green);
            }else{
                mBg.setBackgroundResource(R.drawable.bg_card_yellow);
            }
        }
    }



}
